---
id: spring-overview
title: Spring Server Overview
---


import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

[graphql-kotlin-spring-server](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/servers/graphql-kotlin-spring-server)
is a Spring Boot auto-configuration library that automatically configures beans required to start up a reactive GraphQL
web server.

## WebFlux vs WebMVC

This library is built on a [Spring WebFlux (reactive)](https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html) stack which is a non-blocking alternative to a traditional [Spring Web MVC (servlet)](https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html) based stack.
Since the frameworks utilize different threading models they cannot and should not be intermixed.
When building a GraphQL server using `graphql-kotlin-spring-server` all your queries and mutations should follow one of the supported [asynchronous execution models](../../schema-generator/execution/async-models.md).

## Setup

The simplest way to create a new Kotlin Spring Boot app is by generating one using [Spring Initializr.](https://start.spring.io/)

![Image of https://start.spring.io/](../../assets/spring-initializer.png)

Once you get the sample application setup locally, you will need to add `graphql-kotlin-spring-server` dependency:

<Tabs
  defaultValue="gradle"
  values={[
    { label: 'Gradle Kotlin', value: 'gradle' },
    { label: 'Maven', value: 'maven' }
  ]
}>

<TabItem value="gradle">

```kotlin
implementation("com.expediagroup", "graphql-kotlin-spring-server", latestVersion)
```

</TabItem>
<TabItem value="maven">

```xml
<dependency>
    <groupId>com.expediagroup</groupId>
    <artifactId>graphql-kotlin-spring-server</artifactId>
    <version>${latestVersion}</version>
</dependency>
```

</TabItem>
</Tabs>

## Configuration

At a minimum, in order for `graphql-kotlin-spring-server` to automatically configure your GraphQL web server you need to
specify a list of supported packages that can be scanned for exposing your schema objects through reflections.

You can do this through the spring application config or by overriding the `SchemaGeneratorConfig` bean. See customization below.

```yaml
graphql:
  packages:
    - "com.your.package"
```

## Default Routes

Your newly created GraphQL server starts up with following preconfigured default routes:

-   **/graphql** - GraphQL server endpoint used for processing queries and mutations
-   **/subscriptions** - GraphQL server endpoint used for processing subscriptions
-   **/sdl** - Convenience endpoint that returns current schema in Schema Definition Language format
-   **/graphiql** - [An official IDE](https://github.com/graphql/graphiql) under the GraphQL Foundation

Note: **/playground** - [Prisma Labs GraphQL Playground IDE](https://github.com/graphql/graphql-playground) endpoint
is still available, but need to be configured through the [Spring Properties](./spring-properties.md)

## GraalVm Native Image Support

GraphQL Kotlin Spring Server can be compiled to a [native image](https://www.graalvm.org/latest/reference-manual/native-image/)
using GraalVM Ahead-of-Time compilation. See [Gradle plugin](../../plugins/gradle-plugin-usage-graalvm.mdx) and/or
[Maven plugin](../../plugins/maven-plugin-usage-graalvm.md) documentation for details.
